interface IDiscountStrategy{
  calculate(price:number):string;
}

class ChildrenDiscount implements IDiscountStrategy{
  name:string = '学生票';
  off:number = 0.3;
  calculate(price:number):string{
    console.log(`${this.name}打${Math.floor((1-this.off)*10)}折`);
    return ((1-this.off)*price).toFixed(2);
  }
}

class VIPDiscount implements IDiscountStrategy{
  name:string = 'VIP票';
  off:number = 0.7;
  calculate(price:number):string{
    console.log(`${this.name}打${Math.floor((1-this.off)*10)}折`);
    return ((1-this.off)*price).toFixed(2);
  }
}

export {IDiscountStrategy, ChildrenDiscount, VIPDiscount};